home *** CD-ROM | disk | FTP | other *** search
- head 1.9;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.9
- date 91.03.18.13.44.52; author kupfer; state Exp;
- branches ;
- next 1.8;
-
- 1.8
- date 91.03.10.13.43.27; author kupfer; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 91.03.10.11.18.29; author shirriff; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 89.07.31.17.44.49; author david; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 89.01.11.12.20.52; author mendel; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 88.10.20.10.13.40; author nelson; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.09.26.11.51.17; author nelson; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.09.22.20.59.05; author nelson; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.08.16.09.55.23; author nelson; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.9
- log
- @Change "" to <> for include's. Check the return status from Vm_Cmd
- and exit with an appropriate value.
- @
- text
- @/*
- * vmcmd.c --
- *
- * User interface to the Vm_Cmd system call.
- *
- * Copyright (C) 1986 Regents of the University of California
- * All rights reserved.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: /sprite/src/cmds/vmcmd/RCS/vmcmd.c,v 1.8 91/03/10 13:43:27 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)";
- #endif not lint
-
- #include <sprite.h>
- #include <cfuncproto.h>
- #include <option.h>
- #include <vm.h>
-
- /*
- * Command line options.
- */
- int maxPageOutProcs = -1;
- int pagesToCheck = -1;
- int clockSleep = -1;
- int canCOW = -1;
- int freeWhenClean = -1;
- int flushSeg = -1;
- int lowPage = -1;
- int highPage = -1;
- int fsPenalty = -1;
- Boolean resetFsMinMax = FALSE;
- int numPageGroups = -1;
- int alwaysRefuse = -1;
- int alwaysSayYes = -1;
- int corReadOnly = -1;
- int useReadAhead = -1;
- int prefetch = -1;
- int tracesPerSecond = -1;
- Boolean endTracing = FALSE;
- int writeablePageout = -1;
- int writeableRefPageout = -1;
- int extra1 = -1;
- int extra2 = 0;
- #ifdef spur
- int flushOnRefBitClear = -1;
- int setUseHardRefBit = -1;
- int ownStackAndHeap = -1;
- int uniprocessorFlushPage = -1;
- #endif
-
- Option optionArray[] = {
- {OPT_INT, "a", (Address)&alwaysRefuse, "\tSet the always refuse flag.\n"},
- {OPT_INT, "A", (Address)&alwaysSayYes, "\tSet the always say yes flag.\n"},
- {OPT_INT, "c", (Address)&pagesToCheck, "\tNumber of pages to check each iteration of the clock algorithm"},
- {OPT_INT, "C", (Address)&canCOW, "\tSet the copy-on-write flag."},
- {OPT_INT, "f", (Address)&freeWhenClean, "\tSet free when clean flag."},
- {OPT_INT, "F", (Address)&fsPenalty,
- "\tPenalty in seconds to make FS pay."},
- {OPT_TRUE, "fsreset", (Address)&resetFsMinMax,
- "\tReset the FS cache minimum and maximum."},
- {OPT_INT, "x", (Address)&flushSeg, "\tSegment to flush."},
- {OPT_INT, "h", (Address)&highPage, "\tHighest page to flush."},
- {OPT_INT, "l", (Address)&lowPage, "\tLowest page to flush."},
- {OPT_INT, "n", (Address)&numPageGroups,
- "\tNumber of groups to divide available pages into.\n"},
- {OPT_INT, "p", (Address)&maxPageOutProcs, "\tMaximum number of page out procs"},
- {OPT_INT, "P", (Address)&prefetch, "\tSet prefetch flag"},
- {OPT_INT, "r", (Address)&corReadOnly, "\tSet copy-on-ref read-only flag"},
- {OPT_INT, "R", (Address)&useReadAhead, "\tSet use fs read ahead flag"},
- {OPT_INT, "s", (Address)&clockSleep, "\tNumber of seconds between iterations of the clock algorithm"},
- {OPT_INT, "t", (Address)&tracesPerSecond, "\tNumber of times to trace per second"},
- {OPT_TRUE, "T", (Address)&endTracing, "\tEnd tracing"},
- {OPT_INT, "w", (Address)&writeablePageout, "\tSet the vm writeable page out flag"},
- {OPT_INT, "W", (Address)&writeableRefPageout, "\tSet the vm writeable ref page out flag"},
- {OPT_INT, "e", (Address)&extra1, "\tDo extra command, with the number specified\n"},
- {OPT_INT, "X", (Address)&extra2, "\tSecond argument for extra command\n"},
- #ifdef spur
- {OPT_INT, "z", (Address)&flushOnRefBitClear, "\tSet the flush page on ref bit clear flag\n"},
- {OPT_INT, "Z", (Address)&setUseHardRefBit, "\tSet the use hard ref bit flag\n"},
- {OPT_INT, "o", (Address)&ownStackAndHeap, "\tSet the coherency bit in the pte of stack and heap pages\n"},
- {OPT_INT, "u", (Address)&uniprocessorFlushPage, "\tSet the use uniprocessor page flush flag\n"},
- #endif
- };
- int numOptions = sizeof(optionArray) / sizeof(Option);
-
- /*
- * Forward references:
- */
-
- void DoCmd _ARGS_ ((int command, int arg, int *status));
-
-
- /*
- *----------------------------------------------------------------------
- *
- * main --
- *
- * Execute the commands.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Calls Vm_Cmd.
- *
- *----------------------------------------------------------------------
- */
- main(argc, argv)
- int argc;
- char *argv[];
- {
- int status = 0; /* our exit status */
-
- (void)Opt_Parse(argc, argv, optionArray, numOptions, 0);
- if (flushSeg != -1) {
- int arr[3];
- arr[0] = flushSeg;
- arr[1] = lowPage;
- arr[2] = highPage;
- DoCmd(VM_FLUSH_SEGMENT, arr, &status);
- }
- if (freeWhenClean != -1) {
- DoCmd(VM_SET_FREE_WHEN_CLEAN, freeWhenClean, &status);
- }
- if (maxPageOutProcs != -1) {
- DoCmd(VM_SET_PAGEOUT_PROCS, maxPageOutProcs, &status);
- }
- if (pagesToCheck != -1) {
- DoCmd(VM_SET_CLOCK_PAGES, pagesToCheck, &status);
- }
- if (clockSleep != -1) {
- DoCmd(VM_SET_CLOCK_INTERVAL, clockSleep, &status);
- }
- if (canCOW != -1) {
- DoCmd(VM_SET_COW, canCOW, &status);
- }
- if (fsPenalty != -1) {
- DoCmd(VM_SET_FS_PENALTY, fsPenalty, &status);
- }
- if (resetFsMinMax) {
- DoCmd(VM_RESET_FS_STATS, 0, &status);
- }
- if (numPageGroups != -1) {
- DoCmd(VM_SET_NUM_PAGE_GROUPS, numPageGroups, &status);
- }
- if (alwaysRefuse != -1) {
- DoCmd(VM_SET_ALWAYS_REFUSE, alwaysRefuse, &status);
- }
- if (alwaysSayYes != -1) {
- DoCmd(VM_SET_ALWAYS_SAY_YES, alwaysSayYes, &status);
- }
- if (corReadOnly != -1) {
- DoCmd(VM_SET_COR_READ_ONLY, corReadOnly, &status);
- }
- if (useReadAhead != -1) {
- DoCmd(VM_SET_USE_FS_READ_AHEAD, useReadAhead, &status);
- }
- if (prefetch != -1) {
- DoCmd(VM_SET_PREFETCH, prefetch, &status);
- }
- if (tracesPerSecond != -1) {
- DoCmd(VM_START_TRACING, tracesPerSecond, &status);
- }
- if (endTracing) {
- DoCmd(VM_END_TRACING, 0, &status);
- }
- if (writeablePageout != -1) {
- DoCmd(VM_SET_WRITEABLE_PAGEOUT, writeablePageout, &status);
- }
- if (writeableRefPageout != -1) {
- DoCmd(VM_SET_WRITEABLE_REF_PAGEOUT, writeableRefPageout, &status);
- }
- if (extra1 != -1) {
- DoCmd(extra1, extra2, &status);
- }
- #ifdef spur
- if (flushOnRefBitClear != -1) {
- DoCmd(VM_SET_FLUSH_ON_REF_BIT_CLEAR, flushOnRefBitClear, &status);
- }
- if (setUseHardRefBit != -1) {
- DoCmd(VM_SET_USE_HARD_REF_BIT, setUseHardRefBit, &status);
- }
- if (ownStackAndHeap != -1) {
- DoCmd(VM_SET_COHERENCY_BIT, ownStackAndHeap, &status);
- }
- if (uniprocessorFlushPage != -1) {
- DoCmd(VM_SET_UP_FLUSH_PAGE, uniprocessorFlushPage, &status);
- }
- #endif
-
- exit(status);
- }
-
-
- /*
- *----------------------------------------------------------------------
- *
- * DoCmd --
- *
- * Call Vm_Cmd and check for errors.
- *
- * Results:
- * Sets *statusPtr to non-zero if there was an error.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
- void
- DoCmd(cmd, arg, statusPtr)
- int cmd; /* argument to Vm_Cmd */
- int arg; /* ditto */
- int *statusPtr; /* program's exit status (out) */
- {
- if (Vm_Cmd(cmd, arg) != SUCCESS) {
- *statusPtr = 1;
- }
- }
- @
-
-
- 1.8
- log
- @Add -fsreset command.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: /sprite/src/cmds/vmcmd/RCS/vmcmd.c,v 1.7 91/03/10 11:18:29 shirriff Exp Locker: kupfer $ SPRITE (Berkeley)";
- d14 4
- a17 2
- #include "option.h"
- #include "vm.h"
- d86 6
- d112 2
- d120 1
- a120 1
- (void) Vm_Cmd(VM_FLUSH_SEGMENT, arr);
- d123 1
- a123 1
- (void) Vm_Cmd(VM_SET_FREE_WHEN_CLEAN, freeWhenClean);
- d126 1
- a126 1
- (void) Vm_Cmd(VM_SET_PAGEOUT_PROCS, maxPageOutProcs);
- d129 1
- a129 1
- (void) Vm_Cmd(VM_SET_CLOCK_PAGES, pagesToCheck);
- d132 1
- a132 1
- (void) Vm_Cmd(VM_SET_CLOCK_INTERVAL, clockSleep);
- d135 1
- a135 1
- (void) Vm_Cmd(VM_SET_COW, canCOW);
- d138 1
- a138 1
- (void) Vm_Cmd(VM_SET_FS_PENALTY, fsPenalty);
- d141 1
- a141 1
- (void) Vm_Cmd(VM_RESET_FS_STATS, 0);
- d144 1
- a144 1
- (void) Vm_Cmd(VM_SET_NUM_PAGE_GROUPS, numPageGroups);
- d147 1
- a147 1
- (void) Vm_Cmd(VM_SET_ALWAYS_REFUSE, alwaysRefuse);
- d150 1
- a150 1
- (void) Vm_Cmd(VM_SET_ALWAYS_SAY_YES, alwaysSayYes);
- d153 1
- a153 1
- (void) Vm_Cmd(VM_SET_COR_READ_ONLY, corReadOnly);
- d156 1
- a156 1
- (void) Vm_Cmd(VM_SET_USE_FS_READ_AHEAD, useReadAhead);
- d159 1
- a159 1
- (void) Vm_Cmd(VM_SET_PREFETCH, prefetch);
- d162 1
- a162 1
- (void) Vm_Cmd(VM_START_TRACING, tracesPerSecond);
- d165 1
- a165 1
- (void) Vm_Cmd(VM_END_TRACING, 0);
- d168 1
- a168 1
- (void) Vm_Cmd(VM_SET_WRITEABLE_PAGEOUT, writeablePageout);
- d171 1
- a171 1
- (void) Vm_Cmd(VM_SET_WRITEABLE_REF_PAGEOUT, writeableRefPageout);
- d174 1
- a174 1
- (void) Vm_Cmd(extra1, extra2);
- d178 1
- a178 1
- (void) Vm_Cmd(VM_SET_FLUSH_ON_REF_BIT_CLEAR, flushOnRefBitClear);
- d181 1
- a181 1
- (void) Vm_Cmd(VM_SET_USE_HARD_REF_BIT, setUseHardRefBit);
- d184 1
- a184 1
- (void) Vm_Cmd(VM_SET_COHERENCY_BIT, ownStackAndHeap);
- d187 1
- a187 1
- (void) Vm_Cmd(VM_SET_UP_FLUSH_PAGE, uniprocessorFlushPage);
- d190 30
- @
-
-
- 1.7
- log
- @Added -e,-X flags.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: /sprite/src/cmds/vmcmd/RCS/vmcmd.c,v 1.6 89/07/31 17:44:49 david Exp Locker: shirriff $ SPRITE (Berkeley)";
- d29 1
- d56 3
- a58 1
- "\tPenalty in seconds to make FS pay.\n"},
- d129 3
- @
-
-
- 1.6
- log
- @Added the uniprocessorFlushPage option for spur.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: /a/newcmds/vmcmd/RCS/vmcmd.c,v 1.5 89/01/11 12:20:52 mendel Exp Locker: david $ SPRITE (Berkeley)";
- d39 2
- d70 2
- d156 3
- @
-
-
- 1.5
- log
- @Added ownStackAndHeap command for spur.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: vmcmd.c,v 1.3 88/09/26 11:51:17 nelson Exp $ SPRITE (Berkeley)";
- d39 1
- a39 1
- #ifdef SPUR
- d43 1
- d68 1
- a68 1
- #ifdef SPUR
- d72 1
- d153 1
- a153 1
- #ifdef SPUR
- d162 3
- @
-
-
- 1.4
- log
- @Added flags for David Wood so that he could force heap and stack
- pages to always be modified.
- @
- text
- @d42 1
- d70 1
- d157 3
- @
-
-
- 1.3
- log
- @Added spur dependent flags.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: vmcmd.c,v 1.2 88/09/22 20:59:05 nelson Exp $ SPRITE (Berkeley)";
- d37 2
- d64 2
- d142 6
- @
-
-
- 1.2
- log
- @Removed extraneous commands.
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: vmcmd.c,v 1.1 88/08/16 09:55:23 nelson Exp $ SPRITE (Berkeley)";
- d37 4
- d62 4
- d139 8
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d11 1
- a11 1
- static char rcsid[] = "$Header: vmCmd.c,v 1.8 88/06/20 16:47:19 nelson Exp $ SPRITE (Berkeley)";
- a22 2
- int forceRef = -1;
- int forceSwap = -1;
- a99 6
- }
- if (forceRef != -1) {
- (void) Vm_Cmd(VM_FORCE_REF, forceRef);
- }
- if (forceSwap != -1) {
- (void) Vm_Cmd(VM_FORCE_SWAP, forceSwap);
- @
-